import axios from 'axios';
import _ from 'lodash';
let LocationHostName = window.location.hostname;
console.log("222",LocationHostName)
if (LocationHostName === 'localhost' || LocationHostName === '127.0.0.1') {
    // LocationHostName = '/';
    // LocationHostName = 'http://192.168.3.148:8080';
    //  LocationHostName = 'https://114.55.31.155:8555';// lypc 胡
     LocationHostName = 'https://lanyingv2.blue-imaging.com/prod-api/';// lypc 胡
     


    // 测试服
    //LocationHostName = 'http://47.120.2.138:8555';// 测试
    
    // LocationHostName = 'http2://lanyingv2.blue-imaging.com';
}else{
    // 线上
    LocationHostName=window.location.origin
    //  LocationHostName = 'https://114.55.31.155:8555';// lypc
     LocationHostName = 'https://lanyingv2.blue-imaging.com/prod-api/';// lypc 胡
  
   // LocationHostName = 'http://47.120.2.138:8555';// lypc
}
let API = {
    ASSET_SERVER_URL:LocationHostName,

    
// 获取患者影像列表
// GET  /system/patient/list

// 修改密码
// PUT   /system/user/profile/updatePwd?oldPassword=123456&newPassword=1234567

    DCM_viewurlv1:"view.blue-imaging.com",// lianke

    LOGIN: '/api/common/index/login', //登录接口
    LOGINv2: '/phoneLogin', //登录接口
    LOGOUT: '/api/common/index/logout', //退出登录
    ADMIN_LIST: '/api/common/index/index', //管理员列表
    GET_TRR_PAGE: '/api/common/index/getTrrPage', //页面权限树
    SET_PASSWORD: '/api/common/index/setPassword', //修改密码
    SET_PASSWORDv2: '/system/user/profile/updatePwd', //修改密码
    GET_AUTH_TREE: '/api/common/index/getAuthTree', //获取权限树（菜单）
    GET_MAIN_LIST: '/api/common/index/main_list', //首页获取资源列表
    GET_BASE_INFO: '/api/common/bossview/basicinfo', //获取基础配置数据
    LOGIN_IMG: '/api/common/index/uploadImg', //图片上传 
    PERMISSION_INDEX: '/api/permission/admin/index', //获取管理员列表
    PERMISSION_ADD: '/api/permission/admin/add', //新增管理员
    PERMISSION_EDIT: '/api/permission/admin/edit', //编辑管理员
    PERMISSION_DEL: '/api/permission/admin/del', //删除管理员
    PERMISSION_BATCH_DEL: '/api/permission/admin/batchDel', //批量删除管理员
    ORGANIZATION_DEL: '/api/permission/admin/delOrg', //删除组织
    ORGANIZATION_EDIT: '/api/permission/admin/editOrg', //编辑组织
    ORGANIZATION_ADD: '/api/permission/admin/addOrg', //新增组织
    ORGANIZATION_ROLE_INDEX: '/api/permission/admin/roleIndex', //用户类型
    ORGANIZATION_INDEX: '/api/permission/admin/indexOrg', //组织列表
    ROLE_INDEX: '/api/permission/role/index', //角色列表
    ROLE_DEL: '/api/permission/role/del', //角色删除
    ROLE_ADD: '/api/permission/role/add', //角色增加
    ROLE_EDIT: '/api/permission/role/edit', //角色编辑
    JOURNAL: '/api/log/admin_log/index', //日志列表
    JOURNAL_ROLE: '/api/log/admin_log/role', //日志模块
    vision: '/api/log/visionlog/index', //版本日志列表
    AUTH_DEL: '/api/permission/auth/del', //删除权限
    AUTH_ADD: '/api/permission/auth/add', //权限新增
    AUTH_EDIT: '/api/permission/auth/edit', //权限编辑
    AUTH_INDEX: '/api/permission/auth/index', //权限列表
    DISEASE_DEPARTMENT_INDEX:'/api/basicmanage/Diseasecategory/getList',//疾病列表
    DISEASE_DEPARTMENT_DEL:'/api/basicmanage/Diseasecategory/del',//疾病删除
    DISEASE_DEPARTMENT_EDIT:'/api/basicmanage/Diseasecategory/edit',//疾病编辑
    DISEASE_DEPARTMENT_ADD:'/api/basicmanage/Diseasecategory/add',//疾病添加
    DISEASE_WAREHOUSE_INDEX:'/api/basicmanage/Diseasebank/getList',//疾病库列表
    DISEASE_WAREHOUSE_DEL:'/api/basicmanage/Diseasebank/del',//疾病库删除
    DISEASE_WAREHOUSE_EDIT:'/api/basicmanage/Diseasebank/edit',//疾病库编辑
    DISEASE_WAREHOUSE_ADD:'/api/basicmanage/Diseasebank/add',//疾病库添加
    DISEASE_WAREHOUSE_CATE:'/api/basicmanage/Diseasebank/getalllist',//疾病分类
    HOSPITAL_INDEX:'/api/hospital/Hospital/getList',//医院列表
    gethospitallistall:'/api/hospital/Hospital/getListall',//医院列表下拉
 
    HOSPITAL_DEL:'/api/hospital/Hospital/del',//医院删除
    HOSPITAL_EDIT:'/api/hospital/Hospital/edit',//医院编辑
    HOSPITAL_ADD:'/api/hospital/Hospital/add',//医院添加
    DEPARTMENT_INDEX:'/api/hospital/Department/getList',//科室列表
    DEPARTMENT_INDEXALL:'/api/hospital/Department/getListall',//科室列表全部下拉使用
    DEPARTMENT_DEL:'/api/hospital/Department/del',//科室删除
    DEPARTMENT_EDIT:'/api/hospital/Department/edit',//科室编辑
    DEPARTMENT_ADD:'/api/hospital/Department/add',//科室添加
    DOCTOR_INDEX:'/api/hospital/Doctor/getList',//医生列表
    DOCTOR_DEL:'/api/hospital/Doctor/del',//医生删除
    DOCTOR_EDIT:'/api/hospital/Doctor/edit',//医生编辑
    DOCTOR_ADD:'/api/hospital/Doctor/add',//医生添加
 
    GATHERDEVICE_INDEX:'/api/operation/Collectdevice/getList',//采集设备列表
    GATHERDEVICE_DEL:'/api/operation/Collectdevice/del',//采集设备删除
    GATHERDEVICE_EDIT:'/api/operation/Collectdevice/edit',//采集设备编辑
    GATHERDEVICE_ADD:'/api/operation/Collectdevice/add',//采集设备添加 
    GATHER_INDEX:'/api/operation/Collectlist/getList',//采集列表列表
    GATHER_DEL:'/api/operation/Collectlist/del',//采集列表删除
    GATHER_EDIT:'/api/operation/Collectlist/edit',//采集列表编辑
    GATHER_ADD:'/api/operation/Collectlist/add',//采集列表添加 
    WAREHOUSE_INDEX:'/api/basicmanage/Bodypart/getList',//部位列表
    WAREHOUSE_DEL:'/api/basicmanage/Bodypart/del',//部位删除
    WAREHOUSE_EDIT:'/api/basicmanage/Bodypart/edit',//部位编辑
    WAREHOUSE_ADD:'/api/basicmanage/Bodypart/add',//部位新增
    CLOUDDIAGNOSIS_INDEX:'/api/clouddiagnosis/Clouddiagnosis/getList',//云诊断列表
    CLOUDDIAGNOSIS_INDEX2:'/api/wechat/Outcomtodoapi/testlkdcmlist1',//云诊断列表
    CLOUDDIAGNOSIS_DEL:'/api/clouddiagnosis/Clouddiagnosis/del',//云诊断删除
    CLOUDDIAGNOSIS_EDIT:'/api/clouddiagnosis/Clouddiagnosis/edit',//云诊断编辑
    CLOUDDIAGNOSIS_ADD:'/api/clouddiagnosis/Clouddiagnosis/add',//云诊断新增
    CLOUDDIAGNOSISCOPY_ADD:'/api/clouddiagnosis/Clouddiagnosis/copyadd',//云诊断复制新增
    CLOUDDIAGNOSIS_countyzdbasicinfo:'/api/clouddiagnosis/Clouddiagnosis/countyzdbasicinfo',//云诊端数据看板
    SELFTEMP_INDEX:'/api/diagnosetemp/selftemp/getList',//个人模板列表
    SELFTEMP_DEL:'/api/diagnosetemp/selftemp/del',//个人模板删除
    SELFTEMP_EDIT:'/api/diagnosetemp/selftemp/edit',//个人模板编辑
    SELFTEMP_ADD:'/api/diagnosetemp/selftemp/add',//个人模板新增
    SELFTEMP_TYPE:'/api/common/bossview/getdiagnoseTempBaseInfo',//个人模板部分检查类型

    SELFTEMP_TYPEv2:'/system/part/listBodyPart',//个人模板部分检查类型
    SELFTEMP_checkTYPEv2:'/system/dict/data/type/crm_check_type',//个人模板部分检查类型
    
    CLOUDDIAGNOSIS_TODICOM:'/api/clouddiagnosis/Clouddiagnosis/dcmfileup',//影像资料上传
    CLOUDDIAGNOSIS_VIEWREPORT:'/api/clouddiagnosis/Clouddiagnosis/viewreport',//诊断报告
    CLOUDDIAGNOSIS_WRITEREPORT:'/api/clouddiagnosis/Clouddiagnosis/writereport',//编辑报告
    CLOUDDIAGNOSIS_DETAIL:'/api/clouddiagnosis/Clouddiagnosis/detail',//详情 
    CLOUDDIAGNOSIS_lockreport:'/api/common/bossview/lockreport',//锁定

    USER_EXPORT:'/api/common/bossview/userexport',//人模板编辑
    

    MIBILE_ADMIN_LIST:'/api/common/bossview/reporttList',//手机端报告列表
    MIBILE_ADMIN_LISTv2:'/system/patient/list',//手机端报告列表
    MIBILE_ADMIN_LISTv202:'/system/patient/phoneList',//手机端报告列表
    MIBILE_ADMIN_LISTokv2:'/system/report/list',//手机端报告列表已报告
    MIBILE_ADMIN_LISTokv201:'/system/report/list',//手机端报告列表已报告
    MIBILE_ADMIN_LISTokv2:'/system/report/phoneList',//手机端报告列表已报告
    MOBILE_SEE_BG:'/api/common/bossview/userviewreport',//扫码查看报告
    MOBILE_SEE_BGv2:'/patientGetReport',//扫码查看报告
    MOBILE_REPORT_DETAIL:'/api/common/bossview/mreportdetail',//查看报告详情
    MOBILE_REPORT_DETAILv2:'/system/patient/',//查看报告详情

    MOBILE_REPORT_viewreportossv2:'/system/patient/report',//预览报告详情
    MOBILE_REPORT_viewreportossv202:'/phone',//预览报告详情 /system/report/phone/63
    MOBILE_REPORT_VIEWREPORT:'/api/common/bossview/mviewreport',//预览报告手机端
    MOBILE_REPORT_TREE_EDIT:'/api/common/bossview/mwritereport',//保存更新数据
    MOBILE_REPORT_TREE_EDITv2:'/system/patient/saveReport',//保存更新数据
    MOBILE_REPORT_TREE_EDITv202:'/system/report/checkReport',//保存更新数据
    MOBILE_REPORT_TREE_CHANGEst:'/api/common/bossview/mchangereportst',//更新数状态
    MOBILE_REPORT_TREE_CHANGEstv2:'/system/report/recall',//更新数状态
    MOBILE_REPORT_SHAREREPORT:'/api/common/bossview/msharereport',//分享报告
    MOBILE_REPORT_TREE:'/api/common/bossview/getbodyPartmodelsys',//树形结构
    MOBILE_REPORT_TREEv2:'/system/part/listBodyPart',//树形结构
    MOBILE_REPORT_EDIT:'/api/common/bossview/editPatient',//信息编辑
    MOBILE_REPORT_EDITv2:'/system/patient',//信息编辑
    MOBILE_REPORT_TREE_SELF:'api/common/bossview/getbodyPartmodelself',//树形结构--自己的
    MOBILE_REPORT_TREE_SELFv2:'/system/part/listBodyPart',//树形结构--自己的

    MOBILE_REPORT_TREEsys_level2:'/system/hospitalTemplate/listByBodyPartId',//树形结构详情
    MOBILE_REPORT_TREEself_level2:'/system/template/listByDoctorId',//树形结构详情
    
    MOBILE_REPORT_TREE_DETAIL:'/api/common/bossview/getbodyPartmodeldetail',//树形结构详情
    MOBILE_REPORT_TREE_DETAIL_SELF:'/api/common/bossview/getbodyPartmodelselfdetail',//树形结构详情---自己的
    MOBILE_SELF_TEMPLATE_INDEX:'/api/common/bossview/selfModelList',//人模板列表
    MOBILE_SELF_TEMPLATE_INDEXv2:'/system/template/list',//人模板列表
    MOBILE_SELF_TEMPLATE_ADD:'/api/common/bossview/selfModeladd',//人模板列表
    MOBILE_SELF_TEMPLATE_ADDv2:'/system/template',//人模板列表
    MOBILE_SELF_TEMPLATE_TYPE:'/api/common/bossview/getdiagnoseTempBaseInfo',//人模板类型
    MOBILE_SELF_TEMPLATE_EDIT:'/api/common/bossview/selfModeledit',//个人模板编辑
    MOBILE_SELF_TEMPLATE_EDITv2:'/system/template',//个人模板编辑
    MOBILE_SELF_TEMPLATE_DEL:'/api/common/bossview/selfModeldel',//个人模板删除
    MOBILE_SELF_TEMPLATE_DELv2:'/system/template',//个人模板删除
    getnetworkisping:'/api/common/bossview/getnetworkisping',//更新数状态

    QUERY_CHECK_SEARCH:'/api/common/bossview/mreportDetailbyHandserch',//查询是佛有订单
    QUERY_CHECK_SEARCHv2:'/getByCheckNoAndHospitalId',//先查询窗口是否 根据检查号
    // getAllReport?name=杨梓莺&idCardSuffix=303623
    getAllReport:'/getAllReport',//先查询窗口是否 根据检查号
    



};

export function getConfig(){
    return new Promise(resolve=>{
        axios.get(`${window.location.origin+window.location.pathname}webconfig.json?v=${new Date().getTime()}`).then((response) => {
            if (response.data && _.isPlainObject(response.data)) {
                resolve(Object.assign(API, response.data))
            }else{
                resolve(API)
            }
        }, () => {
            resolve(API)
        });
    })
}
export default API;


